/* 公用表格和列表页面样式 */

/* 主容器 */
.list-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    background-color: var(--main-bg, #f5f7fa);
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
}

/* 搜索和操作栏 */
.list-header {
    padding: 20px;
    background-color: var(--bg-color, #ffffff);
    border-bottom: 1px solid var(--border-color, #eaeaea);
    border-radius: 4px 4px 0 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.search-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.search-form-item label {
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-color, #333333);
    font-size: 14px;
}

.search-form-item .el-input,
.search-form-item .el-select {
    width: 100% !important;
}

/* 搜索按钮栏 */
.search-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
}

.search-actions :deep(.el-button) {
    min-width: 100px;
}

/* 表格容器 */
.list-content {
    flex: 1;
    padding: 20px;
    background-color: var(--bg-color, #ffffff);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-sizing: border-box;
}

/* 表格样式 */
.list-table {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.list-table :deep(.el-table) {
    background-color: var(--bg-color, #ffffff);
    color: var(--text-color, #333333);
    width: 100%;
    height: 100%;
}

/* 让 el-table 使用内容宽度（自然宽度），以便外层 wrapper 出现横向滚动 */
.table-scroll-wrapper :deep(.el-table) {
    display: inline-block;
    min-width: max-content;
    /* 使用内容宽度，超出时产生横向滚动 */
    width: auto !important;
}

.list-table :deep(.el-table__header) {
    background-color: #fafafa;
    flex-shrink: 0;
}

.list-table :deep(.el-table__header th) {
    background-color: #fafafa;
    color: var(--text-color, #333333);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color, #eaeaea);
}

.list-table :deep(.el-table__body tr:hover > td) {
    background-color: #f5f7fa !important;
}

.list-table :deep(.el-table__body-wrapper) {
    overflow-y: auto;
    flex: 1;
}

/* 表格行高 */
.list-table :deep(.el-table__row) {
    height: 48px;
}

.list-table :deep(.el-table__cell) {
    padding: 12px 0;
    color: var(--text-color, #333333);
}

/* 分页容器 */
.list-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 20px;
    background-color: var(--bg-color, #ffffff);
    border-top: 1px solid var(--border-color, #eaeaea);
    border-radius: 0 0 4px 4px;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
}

.list-footer :deep(.el-pagination) {
    margin: 0;
}

/* 操作列按钮 */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: nowrap;
    /* 保证在同一行 */
    white-space: nowrap;
    /* 防止换行 */
}

.action-buttons :deep(.el-button) {
    margin: 0;
    padding: 6px 12px;
    flex: 0 0 auto;
    /* 不允许按钮收缩或扩展，保持固有大小 */
}

.action-buttons :deep(.el-button--small) {
    font-size: 12px;
}

.action-buttons :deep(.el-button--text) {
    padding: 4px 8px;
}

/* 水平滚动包装器：允许横向溢出并滚动 */
.table-scroll-wrapper {
    width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* 水平滑动进度条样式 */
.horizontal-scroll {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 10px;
    background: transparent;
    margin-top: 8px;
    cursor: pointer;
}

.horizontal-scroll::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(90deg, #e6eef9, #cfe4fb);
    border-radius: 4px;
}

.horizontal-scroll::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #409eff;
    border-radius: 50%;
    margin-top: -4px;
}

.horizontal-scroll:focus {
    outline: none;
}

/* 空状态提示 */
.empty-state {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 400px;
    color: #909399;
    font-size: 14px;
}

.empty-state-icon {
    font-size: 64px;
    color: #d3d3d3;
    margin-bottom: 16px;
}

/* 加载状态 */
.list-loading {
    position: relative;
}

.list-loading :deep(.el-overlay) {
    border-radius: 4px;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .search-form {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .list-header {
        padding: 16px;
    }

    .list-content {
        padding: 16px;
    }

    .list-footer {
        padding: 16px;
        justify-content: center;
    }

    .search-form {
        grid-template-columns: 1fr;
    }

    .search-actions {
        flex-wrap: wrap;
    }

    .list-table :deep(.el-table__cell) {
        padding: 8px 0;
    }

    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons :deep(.el-button) {
        width: 100%;
    }
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {

    .list-header,
    .list-content,
    .list-footer {
        background-color: #2a2a2a;
        color: #e0e0e0;
    }

    .list-table :deep(.el-table__header) {
        background-color: #1f1f1f;
    }

    .list-table :deep(.el-table__body tr:hover > td) {
        background-color: #3a3a3a !important;
    }
}